import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, ManyToOne, JoinColumn } from 'typeorm';
import { User } from './User';
import { ChatGroup } from './ChatGroup';

@Entity('group_members')
export class GroupMember {
  @PrimaryGeneratedColumn()
  member_id!: number;

  @Column()
  group_id!: number;

  @Column()
  id!: number;

  @CreateDateColumn()
  joined_at!: Date;

  @ManyToOne(() => ChatGroup, group => group.members)
  @JoinColumn({ name: 'group_id' })
  group!: ChatGroup;

  @ManyToOne(() => User)
  @JoinColumn({ name: 'id' })
  user!: User;
} 